summaryrefslogtreecommitdiff
path: root/app/[lng]/partners/(partners)/bid/page.tsx
blob: bcb2ad25f75a3661d61347fbc347c00bb813e64d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { PartnersBiddingList } from '@/lib/bidding/vendor/partners-bidding-list'
import { Suspense } from 'react'
import { Skeleton } from '@/components/ui/skeleton'
import { getServerSession } from 'next-auth'
import { authOptions } from "@/app/api/auth/[...nextauth]/route"

export default async function PartnersBidPage() {
  // 세션에서 companyId 가져오기
  const session = await getServerSession(authOptions)
  const companyId = session?.user?.companyId

  if (!companyId) {
    return (
      <div className="container mx-auto py-6">
        <div className="text-center">
          <h1 className="text-2xl font-bold text-destructive">회사 정보가 없습니다. 다시 로그인 해주세요.</h1>
        </div>
      </div>
    )
  }

  return (
    <div className="container mx-auto py-6 space-y-6">
      <div className="flex items-center justify-between">
        <div>
          <h1 className="text-3xl font-bold">입찰 참여</h1>
          <p className="text-muted-foreground mt-2">
            참여 가능한 입찰 목록을 확인하고 응찰하실 수 있습니다.
          </p>
        </div>
      </div>

      <Suspense fallback={<BiddingListSkeleton />}>
        <PartnersBiddingList companyId={companyId} />
      </Suspense>
    </div>
  )
}

function BiddingListSkeleton() {
  return (
    <div className="space-y-4">
      <Skeleton className="h-12 w-full" />
      <div className="space-y-2">
        {Array.from({ length: 5 }).map((_, i) => (
          <Skeleton key={i} className="h-16 w-full" />
        ))}
      </div>
    </div>
  )
}